#include "stm32f10x.h"                  // Device header
#include "Delay.h"

#include "LED.h"
#include "Key.h"
#include "OLED.h"
#include "SG90.h"

uint16_t i;

uint16_t Angle = 0;
uint8_t KeyNum = 0;

int main(void)
{
	// 初始化
	OLED_Init();
	SG90_Init();
	Key_Init();
	
	OLED_ShowString(1, 1, "Angle:0");
	
	while(1)
	{
		KeyNum = Key_GetNum();
		if(KeyNum == 1)
		{
			Angle = (Angle + 30) % 210;
			SG90_SetAngle(Angle);
			OLED_ShowNum(1, 7, Angle, 3);
		}
	}
}